package chapter19.HandlerStream;

import org.junit.jupiter.api.Test;

import java.io.*;

/**
 * @Auther: Tx
 * @Date: 2022/7/23 22:39
 */
//演示处理流的使用，实际上是对节点流的封装
public class BufferedRead_ {
    @Test
    void test01() throws IOException {
        String filePath = "e:/hello.txt";
        String line;
        BufferedReader bufferedReader = null;
        try {
            bufferedReader = new BufferedReader(new FileReader(filePath));
            while ((line = bufferedReader.readLine()) != null) {
                System.out.println(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
//            这里实际调用的节点流的close()方法
            bufferedReader.close();
        }

    }
}
